package com.leyou.upload.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Package com.leyou.upload.config
 * @Author: HuaMao
 * @Description:
 * @Date: Created in 19:52 2019/6/29
 * @Version v1.0
 */
@Configuration
@EnableConfigurationProperties(OSSProperties.class)
public class OSSConfig {

    @Bean
    public OSS ossClient(OSSProperties prop) {
       return new OSSClientBuilder().build(
               prop.getEndpoint(), prop.getAccessKeyId(), prop.getAccessKeySecret());
    }
}
